<template>
    <div class="left-cpn">
        <ul>
            <li
                v-for="item in list"
                :key="item.id"
                @click="changeLi(item.path)"
                :class="item.path === pathStatus ? 'path-color' : ''"
            >
                {{ item.name }}
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    data() {
        return {
            list: [
                {
                    id: 1,
                    name: '用户信息',
                    path: '/user'
                },
                {
                    id: 2,
                    name: '视频管理',
                    path: '/video'
                },
                {
                    id: 3,
                    name: '数据修改',
                    path: '/datas'
                }
            ],
            pathStatus: '/user'
        };
    },
    methods: {
        changeLi(path) {
            this.pathStatus = path;
            this.$router.push(path);
        }
    }
};
</script>

<style lang="scss" scoped>
.left-cpn {
    width: 220px;
    height: calc(100vh - 80px);
    background: pink;
    ul {
        padding: 0;
        margin-top: 40px;
    }
    li {
        list-style: none;
        margin-top: 10px;
    }
    li:hover {
        cursor: pointer;
    }
    .path-color {
        color: red;
    }
}
</style>
